package com.ylw.httpstest;


import java.security.Provider;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;

public class TT {

    private final AA[] configs;
    // List returned by providers()
    private final List<AA> userList = new AbstractList<AA>() {
        public int size() {
            System.out.println("aaaaaaaaaaaaaa  +  " + configs.length);
            return configs.length;
        }

        public AA get(int index) {
            System.out.println("bbb  " + index);
            return getProvider(index);
        }

    };

    AA getProvider(int index) {
        AA p = configs[index].getProvider();
        return p;
    }

    public TT(List<AA> aa) {
        this.configs = aa.toArray(new AA[0]);
    }

    public static void main(String[] args) {
        List aas = new ArrayList();
        for (int i = 0; i < 10; i++) {
            aas.add(new AA(i));
        }
        TT t = new TT(aas);
        System.out.println(t);
        List aa = t.userList;
        System.out.println(aa.get(0));
    }
}

class AA {

    Integer a;

    public AA getProvider() {
        System.out.println(this.a);
        return this;
    }

    public AA(Integer a) {
        this.a = a;
    }
}
